package com.sinoglobal.ningxia.adapter;

import java.util.ArrayList;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ListAdapter;
import android.widget.TextView;

import com.sinoglobal.ningxia.R;
import com.sinoglobal.ningxia.beans.AreaVo;

/**
 * @Title: ScreenListAdapter.java
 * @Package com.sinoglobal.searchingforfood.fragment
 * @Description: TODO(用一句话描述该文件做什么)
 * @author czz
 * @date 2014-5-13 下午1:58:29
 */
public class ScreenListTwoAdapter extends BaseAdapter implements ListAdapter {

	private Context context;
	public int num = 0;
	public int oldfatherNum = 0;
	public int fatherNum = 0;
	private ArrayList<AreaVo> areaVo;

	public ScreenListTwoAdapter(Context context) {
		this.context = context;
	}

	public ArrayList<AreaVo> getAreaVo() {
		return areaVo;
	}

	public void setAreaVo(ArrayList<AreaVo> areaVo) {

		this.areaVo = areaVo;
	}

	@Override
	public int getCount() {
		//Auto-generated method stub
		return areaVo.size();
	}

	@Override
	public AreaVo getItem(int position) {
		//Auto-generated method stub
		return areaVo.get(position);
	}

	@Override
	public long getItemId(int position) {
		return position;
	}

	@Override
	public View getView(int position, View convertView, ViewGroup parent) {
		convertView = LayoutInflater.from(context).inflate(R.layout.screenlist_two_item, null);
		TextView screnlist_tv = (TextView) convertView.findViewById(R.id.screnlist_tv);
		if (oldfatherNum == fatherNum && num == position) {
			screnlist_tv.setTextColor(context.getResources().getColor(R.color.textOrange));
		}
		screnlist_tv.setText(areaVo.get(position).getZone_name());
		return convertView;
	}
}
